using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameStateManagement;
using Microsoft.Xna.Framework.Input.Touch;


namespace UpChickenFar
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Brick : DrawableGameComponent
    {
        Texture2D _brick_texture;

        public float GetBrickHeigh()
        {
            return _brick_texture.Height;
        }
        public float GetBrickWidth()
        {
            return _brick_texture.Width;
        }

        Vector2 _positon;
        SpriteBatch _spriteBatch;

        float _brick_speed;


        int _draw_able;

        public void SetDrawAble(int draw)
        {
            _draw_able = draw;
        }
        public int GetDrawAble()
        {
            return _draw_able;
        }

        public Vector2 GetPosition()
        {
            return _positon;
        }

        public void SetSpeed(float speed)
        {
            _brick_speed = speed;
        }

        
        public Brick(Game game, Vector2 position, Texture2D brick, float speed, int draw_able)
            : base(game)
        {
            _spriteBatch = UpChickenFar.spriteBatch;
            _positon = position;
            _brick_texture = brick;
            _brick_speed = speed;
            _draw_able = draw_able;
            
        }

        public override void Update(GameTime gameTime)
        {
            if (_draw_able == 1)
            {
                _positon.X += _brick_speed;
            }
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            if (_draw_able == 1)
            {
                _spriteBatch.Begin();
                _spriteBatch.Draw(_brick_texture, _positon, Color.White);
                _spriteBatch.End();
            }
            base.Draw(gameTime);
        }

    }
}
